home *** CD-ROM | disk | FTP | other *** search
/ PC for Alla 2005 May / PC för Alla 0505.iso / fullversioner / realsoft3d / data1.cab / Scripting / scripting / Intro / property.js < prev    next >
Encoding:
Text File  |  2005-04-04  |  1.4 KB  |  54 lines

  1.  
  2. // JavaScript property window sample. Connects to geometric layer using model-view
  3. // concept and reports all events to the user through a read only text field.
  4. // Copyrights 2002, Realsoft Graphics Oy
  5.  
  6. // --- include java script classes --- 
  7.  
  8. include("oops/r3button.js");
  9. include("oops/r3window.js");
  10. include("oops/r3packer.js");
  11. include("oops/r3text.js");
  12.  
  13.  
  14. // create a window
  15.  
  16. view = new r3Window(R3WGA_Parent, _r3gui,
  17.                     R3WGA_Left, 200,
  18.                     R3WGA_Top, 100,
  19.                     R3WA_Title, "My Property Window",
  20.                     R3WA_ReportCloseWindow, TRUE,
  21.                     R3WA_ReportNewSize, TRUE);
  22.  
  23. // create a text field for the window
  24.  
  25. info = new r3Text(R3WGA_Parent, view,
  26.                   R3GA_Text, "Event",
  27.                   R3GTA_Border, TRUE);
  28.                   
  29.  
  30. // use packer to manage the text field
  31. packer = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
  32. packer.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, info);
  33. view.SetGmanager(packer);
  34.  
  35.  
  36. // define update method for the model-view 
  37.  
  38. function myUPDATE(value, modelID, eventID)
  39. {
  40.     info.SetText("Event: " + eventID);
  41. }
  42.  
  43. view.UPDATE = myUPDATE;
  44.  
  45.  
  46. // connect the window to geom. layer
  47.  
  48. model = GetJS("CurrentProject.Geometrics");
  49. model.ADDDEPENDENT(0, 0, view);
  50.  
  51. // update the layout and realize the window
  52. view.FIT(R3WFP_BESTFIT);
  53. view.REALIZE();
  54.